<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title> 4-5 重复重复（for循环）</title>
    <link rel="stylesheet" type="text/css" href="../../../css/style.css"/>
    <style type="text/css">
    </style>

    <script type="text/javascript">
        function test(){
            var mymoney,sum=0;//mymoney变量存放不同面值，sum总计
            for(mymoney=1;mymoney<=10;mymoney++)
            {
                sum= sum + mymoney;
            }
            document.write("sum合计:"+sum+"<br>");
        }


        function test2(){
            var num=1;
            for(num=1;num<=6;num++){  //初始化值,循环条件;循环后条件值更新
                document.write("取出第"+"num"+"个球<br />");

            }
        }

    </script>
</head>

<body>
<div align="center">
    <p><a href="../../index.php#jsjjp" class="fontSize" title="点击进入该目录">目录</a></p>
</div>

<input type="button" value="第一个循环测试" onclick="test()"><br />
<input type="button" value="第二个循环测试" onclick="test2()">

<script type="text/javascript">

</script>

</body>
</html>
